﻿using System;
using System.Collections;
using System.Globalization;
using System.Xml;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.WorkItemTracking.Client;

namespace CodePlex.TeamFoundation.Adapters.WorkItemTracking
{
  /// <summary>
  /// Interface for 
  /// Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore
  /// </summary>
  public interface IWorkItemStore
  {
    string CallingProcessIdentity { get; set; }
    CultureInfo CultureInfo { get; }
    // TODO: Implement IWorkItemStoreDiagnostics
    WorkItemStoreDiagnostics Diagnostics { get; }
    // TODO: Implement I
    FieldDefinitionCollection FieldDefinitions { get; }
    // TODO: Implement IProjects
    ProjectCollection Projects { get; }
    // TODO: Implement IRegisteredLinkTypeCollection
    RegisteredLinkTypeCollection RegisteredLinkTypes { get; }
    TeamFoundationServer TeamFoundationServer { get; }
    TimeZone TimeZone { get; }
    UserDisplayMode UserDisplayMode { get; }

    event ImportEventHandler ImportEventHandler;
    event MetadataChangeEventHandler MetadataChanged;
    [Obsolete("This event is obsolete, will be removed in RTM tree. Use MetadataChanged instead.")]
    event MetadataChangeEventHandler MetadataChanging;

    BatchSaveError[] BatchSave(WorkItem[] workitems);
    XmlDocument ExportGlobalLists();
    Uri[] GetReferencingWorkItemUris(Uri referencedUri);
    StoredQuery GetStoredQuery(Guid guid);
    IWorkItem GetWorkItem(int id);
    IWorkItem GetWorkItem(Uri uri);
    IWorkItem GetWorkItem(int id, DateTime at);
    IWorkItem GetWorkItem(int id, int revision);
    IWorkItem GetWorkItem(Uri uri, DateTime at);
    IWorkItem GetWorkItem(Uri uri, int revision);
    void ImportGlobalLists(string lists);
    void ImportGlobalLists(XmlElement listsElement);
    WorkItemCollection Query(string wiql);
    WorkItemCollection Query(BatchReadParameterCollection batchReadParams, string wiql);
    WorkItemCollection Query(string wiql, IDictionary context);
    int QueryCount(string wiql);
    int QueryCount(string wiql, IDictionary context);
    void RefreshCache();
    bool SyncToCache();
  }
}
